package se.webbzon.boltzmann.world;

public enum RegionEnum {
	
	none(""), euler("Euler Village"), darwin("Darwin District"), 
	tree("Inside The Huge Tree"), raphson("Raphson City"), bin("The Fire Bin");
	
	private final String regionName;
	
	/*============================================================
	Constructors
	============================================================*/
	
	private RegionEnum(String regionName) {
		this.regionName = regionName;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the name of this region. **/
	public String getRegionName() {
		return regionName;
	}
	
	/** Returns the region of the world area with the given world
	 * area name. **/
	public static RegionEnum fromWorldAreaName(String worldAreaName) {
		String[] location = worldAreaName.split("/");
		if (location.length > 1) {
			for (RegionEnum region : values()) {
				if (region.name().equals(location[0]))
					return region;
			}
		}
		return none;
	}

}
